package com.winai.launcher.bean;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * 作者：康少
 * 时间：2019/12/13 0013
 * 说明：闹钟设置星期几重复的 对象
 */
public class WeekRepeatBean implements Parcelable {
    private int tvNameInt;
    private String tvName;
    private boolean isChecked;

    public WeekRepeatBean(String tvName, boolean isChecked) {
        if (tvName.contains("一")) {
            tvNameInt = 1;
        } else if (tvName.contains("二")) {
            tvNameInt = 2;
        } else if (tvName.contains("三")) {
            tvNameInt = 3;
        } else if (tvName.contains("四")) {
            tvNameInt = 4;
        } else if (tvName.contains("五")) {
            tvNameInt = 5;
        } else if (tvName.contains("六")) {
            tvNameInt = 6;
        } else if (tvName.contains("日")) {
            tvNameInt = 7;
        }
        this.tvName = tvName;
        this.isChecked = isChecked;
    }

    public int getTvNameInt() {
        return tvNameInt;
    }

    public String getTvName() {
        return tvName;
    }

    public void setTvName(String tvName) {
        this.tvName = tvName;
    }

    public boolean isChecked() {
        return isChecked;
    }

    public void setChecked(boolean checked) {
        isChecked = checked;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.tvNameInt);
        dest.writeString(this.tvName);
        dest.writeByte(this.isChecked ? (byte) 1 : (byte) 0);
    }

    protected WeekRepeatBean(Parcel in) {
        this.tvNameInt = in.readInt();
        this.tvName = in.readString();
        this.isChecked = in.readByte() != 0;
    }

    public static final Parcelable.Creator<WeekRepeatBean> CREATOR = new Parcelable.Creator<WeekRepeatBean>() {
        @Override
        public WeekRepeatBean createFromParcel(Parcel source) {
            return new WeekRepeatBean(source);
        }

        @Override
        public WeekRepeatBean[] newArray(int size) {
            return new WeekRepeatBean[size];
        }
    };
}
